Validating Attr and Data types

Hello,

I was wondering is there a built in function within DXL that would allow me to validate attributes along with its datatype and available values? I am trying to validate that our database has been fully updated to the correct attribute name and its dataype has the same data values to a master Module. Thank you.

Regards,
Jim
SystemAdmin - Tue Jan 17 11:54:36 EST 2012

Re: Validating Attr and Data types
llandale - Tue Jan 17 12:25:39 EST 2012

There is certainly no such built in function.

It seems to me the CopyAtts.dxl function will copy the Master module's attributes down to all the other modules, and will tell you when an attribute already exists but has a different Type. In any event, you are going to have to get the Master's defintitions, and compare them to each of the subordinate modules which you would open.

As for standard attribute Values ... doesn't make sense that all objects have the same value. It makes little sense that all module-level attributes would have the same value either; although perhaps "NameOfProgram" may be an exception.

-Louie

Re: Validating Attr and Data types
SystemAdmin - Tue Jan 17 12:41:28 EST 2012

llandale - Tue Jan 17 12:25:39 EST 2012
There is certainly no such built in function.

It seems to me the CopyAtts.dxl function will copy the Master module's attributes down to all the other modules, and will tell you when an attribute already exists but has a different Type. In any event, you are going to have to get the Master's defintitions, and compare them to each of the subordinate modules which you would open.

As for standard attribute Values ... doesn't make sense that all objects have the same value. It makes little sense that all module-level attributes would have the same value either; although perhaps "NameOfProgram" may be an exception.

-Louie

Thank you.

I was trying to say I would like to validate the datatype values(available vaules) I am not trying to do data validation against the actualy values choosen by the engineers.

Thank you,
Jim

Re: Validating Attr and Data types
SystemAdmin - Tue Jan 17 23:05:54 EST 2012

SystemAdmin - Tue Jan 17 12:41:28 EST 2012
Thank you.

I was trying to say I would like to validate the datatype values(available vaules) I am not trying to do data validation against the actualy values choosen by the engineers.

Thank you,
Jim

Hello,

Is there a better way of verifing that all user defined attributes match a Master Module?

Thank you,
Jim
 

Module Master = read("????",false)
Module Curr = read("????",false)
 
Skip skpAttrNames = createString   // KEY and DATA both 'string' Name of attr to verify
 
Skip MasterList(Skip skpAttrNames)
{
    // Custom attributes to keep according to EP 03-04 Rev 1 - Hainan CNPE
        //put(skpAttrNames, "xx", "xx") 
        put(skpAttrNames, "ATOS", "ATOS") 
        put(skpAttrNames, "FOXVIEW", "FOXVIEW") 
        put(skpAttrNames, "_Req Eval", "_Req Eval")
        put(skpAttrNames, "_Req Type", "_Req Type")
        put(skpAttrNames, "_Criticality", "_Criticality")
        put(skpAttrNames, "_1E Req", "_1E Req")
        put(skpAttrNames, "_NC+ Req", "_NC+ Req")
        put(skpAttrNames, "_NC Req", "_NC Req")
        put(skpAttrNames, "_Level 2 Req", "_Level 2 Req")
        put(skpAttrNames, "_Level 3 Req", "_Level 3 Req")
        put(skpAttrNames, "_Comments", "_Comments")
        put(skpAttrNames, "_Remarks", "_Remarks")
        put(skpAttrNames, "_IV&V ASW Req", "_IV&V ASW Req")
        put(skpAttrNames, "_IV&V Feasible", "_IV&V Feasible")
        put(skpAttrNames, "_IV&V Testable", "_IV&V Testable")
        put(skpAttrNames, "_IV&V Comments", "_IV&V Comments")
        put(skpAttrNames, "_IV&V Remarks", "_IV&V Remarks")
        // RPE Attr(s) Module Level [Attr]
        put(skpAttrNames, "_doc_number", "_doc_number")
        put(skpAttrNames, "_revision", "_revision")
        put(skpAttrNames, "_status", "_status")
        put(skpAttrNames, "_volume_number", "_volume_number")
        put(skpAttrNames, "main_activity_1", "main_activity_1")
        put(skpAttrNames, "main_activity_2", "main_activity_2")
        put(skpAttrNames, "originator_1", "originator_1")
        put(skpAttrNames, "originator_2", "originator_2")
        put(skpAttrNames, "originator_3", "originator_3")
        put(skpAttrNames, "originator_4", "originator_4")
        put(skpAttrNames, "project_reference_1", "project_reference_1")
        put(skpAttrNames, "project_reference_2", "project_reference_2")
        put(skpAttrNames, "serial_number_1", "serial_number_1")
        put(skpAttrNames, "serial_number_2", "serial_number_2")
        put(skpAttrNames, "serial_number_3", "serial_number_3")
        put(skpAttrNames, "sub_activity_1", "sub_activity_1")
        put(skpAttrNames, "sub_activity_2", "sub_activity_2")
        put(skpAttrNames, "sub_activity_3", "sub_activity_3")
        put(skpAttrNames, "sub_activity_4", "sub_activity_4")
        put(skpAttrNames, "sub_activity_5", "sub_activity_5")
        put(skpAttrNames, "type_1", "type_1")
        put(skpAttrNames, "type_2", "type_2")
        put(skpAttrNames, "unit","unit")
        
        return(skpAttrNames)
}
 
void AttrMatch(Skip skp1, Module Master, Module Curr)
{
        string  NameAttr1
 
        for NameAttr1 in skp1 do
        {
                bool flag = true
 
                AttrDef         ad1 = find(Master, NameAttr1)
                AttrDef         ad2 = find(Curr, NameAttr1)
                
                if(ad1 != null && ad2 != null)
                {
                        AttrType        at1 = ad1.type
                        AttrType        at2 = ad2.type
                         
                        AttrBaseType    abt1 = at1.type
                        AttrBaseType    abt2 = at2.type
                        
                        // Only care about enum values & that [Attr] exist within current Module.
                        if(abt1 == attrEnumeration && abt2 == attrEnumeration) // Both Enumerated
                        {
                                if(at1.size == at2.size)
                                {for(i=0; i<at1.size && flag; i++){if (!(at1.strings[i] == at2.strings[i])){ flag = false }}}
                                else{print NameAttr1 "[Attr] doesn't match Master Copy.\n"}
                        }    // end checking when both are Enumerated
                        if (!flag){print NameAttr1 "[Attr] doesn't match Master Copy.\n"}
                }
                else
                {
                        if(ad1 == null)
                        {print NameAttr1 "[Attr] doesn't exist in Master List.\n"}
                        else if (ad2 == null)
                        {print NameAttr1 "[Attr] Missing in Module.\n"}
                }
        }
}
AttrMatch(MasterList(skpAttrNames), Master, Curr)
delete(skpAttrNames) // Freeing memory...
 
close(Master)
close(Curr)

Re: Validating Attr and Data types
llandale - Wed Jan 18 12:18:56 EST 2012

SystemAdmin - Tue Jan 17 23:05:54 EST 2012

Hello,

Is there a better way of verifing that all user defined attributes match a Master Module?

Thank you,
Jim
 

Module Master = read("????",false)
Module Curr = read("????",false)
 
Skip skpAttrNames = createString   // KEY and DATA both 'string' Name of attr to verify
 
Skip MasterList(Skip skpAttrNames)
{
    // Custom attributes to keep according to EP 03-04 Rev 1 - Hainan CNPE
        //put(skpAttrNames, "xx", "xx") 
        put(skpAttrNames, "ATOS", "ATOS") 
        put(skpAttrNames, "FOXVIEW", "FOXVIEW") 
        put(skpAttrNames, "_Req Eval", "_Req Eval")
        put(skpAttrNames, "_Req Type", "_Req Type")
        put(skpAttrNames, "_Criticality", "_Criticality")
        put(skpAttrNames, "_1E Req", "_1E Req")
        put(skpAttrNames, "_NC+ Req", "_NC+ Req")
        put(skpAttrNames, "_NC Req", "_NC Req")
        put(skpAttrNames, "_Level 2 Req", "_Level 2 Req")
        put(skpAttrNames, "_Level 3 Req", "_Level 3 Req")
        put(skpAttrNames, "_Comments", "_Comments")
        put(skpAttrNames, "_Remarks", "_Remarks")
        put(skpAttrNames, "_IV&V ASW Req", "_IV&V ASW Req")
        put(skpAttrNames, "_IV&V Feasible", "_IV&V Feasible")
        put(skpAttrNames, "_IV&V Testable", "_IV&V Testable")
        put(skpAttrNames, "_IV&V Comments", "_IV&V Comments")
        put(skpAttrNames, "_IV&V Remarks", "_IV&V Remarks")
        // RPE Attr(s) Module Level [Attr]
        put(skpAttrNames, "_doc_number", "_doc_number")
        put(skpAttrNames, "_revision", "_revision")
        put(skpAttrNames, "_status", "_status")
        put(skpAttrNames, "_volume_number", "_volume_number")
        put(skpAttrNames, "main_activity_1", "main_activity_1")
        put(skpAttrNames, "main_activity_2", "main_activity_2")
        put(skpAttrNames, "originator_1", "originator_1")
        put(skpAttrNames, "originator_2", "originator_2")
        put(skpAttrNames, "originator_3", "originator_3")
        put(skpAttrNames, "originator_4", "originator_4")
        put(skpAttrNames, "project_reference_1", "project_reference_1")
        put(skpAttrNames, "project_reference_2", "project_reference_2")
        put(skpAttrNames, "serial_number_1", "serial_number_1")
        put(skpAttrNames, "serial_number_2", "serial_number_2")
        put(skpAttrNames, "serial_number_3", "serial_number_3")
        put(skpAttrNames, "sub_activity_1", "sub_activity_1")
        put(skpAttrNames, "sub_activity_2", "sub_activity_2")
        put(skpAttrNames, "sub_activity_3", "sub_activity_3")
        put(skpAttrNames, "sub_activity_4", "sub_activity_4")
        put(skpAttrNames, "sub_activity_5", "sub_activity_5")
        put(skpAttrNames, "type_1", "type_1")
        put(skpAttrNames, "type_2", "type_2")
        put(skpAttrNames, "unit","unit")
        
        return(skpAttrNames)
}
 
void AttrMatch(Skip skp1, Module Master, Module Curr)
{
        string  NameAttr1
 
        for NameAttr1 in skp1 do
        {
                bool flag = true
 
                AttrDef         ad1 = find(Master, NameAttr1)
                AttrDef         ad2 = find(Curr, NameAttr1)
                
                if(ad1 != null && ad2 != null)
                {
                        AttrType        at1 = ad1.type
                        AttrType        at2 = ad2.type
                         
                        AttrBaseType    abt1 = at1.type
                        AttrBaseType    abt2 = at2.type
                        
                        // Only care about enum values & that [Attr] exist within current Module.
                        if(abt1 == attrEnumeration && abt2 == attrEnumeration) // Both Enumerated
                        {
                                if(at1.size == at2.size)
                                {for(i=0; i<at1.size && flag; i++){if (!(at1.strings[i] == at2.strings[i])){ flag = false }}}
                                else{print NameAttr1 "[Attr] doesn't match Master Copy.\n"}
                        }    // end checking when both are Enumerated
                        if (!flag){print NameAttr1 "[Attr] doesn't match Master Copy.\n"}
                }
                else
                {
                        if(ad1 == null)
                        {print NameAttr1 "[Attr] doesn't exist in Master List.\n"}
                        else if (ad2 == null)
                        {print NameAttr1 "[Attr] Missing in Module.\n"}
                }
        }
}
AttrMatch(MasterList(skpAttrNames), Master, Curr)
delete(skpAttrNames) // Freeing memory...
 
close(Master)
close(Curr)

That looks reasonable.

  • I'd probably also check to make sure the names of the types match exactly also.
  • I notice its your script that decides which are "supposed" to be in the Master. So when your template changes so must your script. I think I'd be tempted to presume the Master is correct, then read the attributes in the Master and make sure each is in the current.
  • You probably want a different wrapper, checking all the modules in some folder.

-Louie